class Course < ActiveRecord::Base

  has_many :enrollments
  belongs_to :user
  belongs_to :forum
  belongs_to :category
  has_many :hyperlinks
  has_many :lessons
  has_many :advices

  validates_presence_of :name
  validates_presence_of :classroom
  validates_presence_of :duration
  validates_presence_of :started_at
  validates_presence_of :finished_at
  validates_presence_of :menu
  validates_presence_of :objective
  validates_presence_of :programatic_content
  validates_presence_of :bibliography
  validates_presence_of :published
  validates_presence_of :minimum
  validates_presence_of :maximum
  validates_presence_of :user
  validates_presence_of :category
  
  validates_uniqueness_of(:user_id,:scope=>[:name, :classroom, :started_at])

end
